package prickworlds.game;

import static org.lwjgl.opengl.GL11.*;
import prickworlds.game.templates.WeaponTemplate;
import prickworlds.graphics.Primitives;
import prickworlds.physics.RectRigidBody;

public class Bullet extends AcceleratingObject {

	/**
	 * radius of the bullet
	 */
	float radius = 0.15f;

	/**
	 * damage of the bullet
	 */
	int damage = 10;

	/**
	 * the number of the team the shot is coming from
	 */
	int team = 0;
	
	float speed = 100.0f;
	float acceleration = 0.0f; 

	public Bullet(WeaponTemplate weapon) {
		this.radius = weapon.getRadius();
		this.damage = weapon.getDamage();
		this.speed = weapon.getSpeed();
		this.acceleration = weapon.getAcceleration();
		super.setHitbox(new RectRigidBody(-radius, -radius, 2 * radius,
				2 * radius));
	}

	@Override
	public void display() {
		switch (team) {
		case 0:
			glColor3f(0, 1, 0);
			break;
		case 1:
			glColor3f(1, 0, 0);
			break;
		default:
			glColor3f(1, 1, 1);
			break;
		}

		Primitives.drawEllipse(posX, posY, radius, radius);
	}

}
